/**
 * 
 */
package com.hand.cloud.b2b.daos.impl;

import de.hybris.platform.servicelayer.exceptions.ModelSavingException;
import de.hybris.platform.servicelayer.model.ModelService;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.hand.cloud.b2b.daos.TBLogisticsDAO;
import com.hand.cloud.b2b.model.EPLogisticsModel;
import com.hand.cloud.b2b.model.TB_LogisticsModel;


/**
 * @author Snowling
 * 
 */
@Component(value = "tbLogisticsDAO")
public class DefaultTBLogisticsDAO implements TBLogisticsDAO
{
	Logger LOG = Logger.getLogger(DefaultEPLogisticDAO.class);

	@Autowired
	ModelService modelService;

	/**
	 * 创建TB物流信息
	 */
	@Override
	public TB_LogisticsModel createTBLogistics(final EPLogisticsModel epLogisticsModel)
	{
		final TB_LogisticsModel tbLogistics = this.modelService.create(TB_LogisticsModel.class);
		tbLogistics.setTid(epLogisticsModel.getTid());
		tbLogistics.setOut_sid(epLogisticsModel.getOutSid());
		tbLogistics.setCompany_code(epLogisticsModel.getCompanyCode());

		try
		{
			LOG.info("----create TB_Logistics error-----");
			this.modelService.save(tbLogistics);
		}
		catch (final ModelSavingException e)
		{
			e.printStackTrace();
		}
		return tbLogistics;
	}

}
